<script setup lang="ts">
//搜索页展示数据
//https://www.smartisan.com/category/151
import { SingleMeat } from "@/store/interface";
import SingleShow from "@/components/block/public/singleShow.vue";
//import "@/components/css/home.css";

defineProps<{ data: SingleMeat[] }>();

const dataList = [
  {
    id: 1,
    title: "综合排序",
    active: true,
  },
  {
    id: 2,
    title: "销量排序",
    active: false,
  },
  {
    id: 3,
    title: "价格低到高",
    active: false,
  },
];
</script>

<template>
  <ul class="container clearfix">
    <li class="item clearfix" v-for="item in dataList" :key="item.id">
      <a class="link" :class="{ active: item.active }">{{ item.title }}</a>
      <span class="dot"></span>
    </li>
  </ul>
  <div class="category-list common-flex-box flex-four multi-line">
    <SingleShow :data="data" />
  </div>
</template>

<style scoped lang="less">
.category-list {
  min-height: 429px;
  border-radius: 8px;
  background-color: #fff;
  overflow: hidden;
}

//自定义
.category-list {
  border-radius: 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.14);
  :deep(.flex-item) {
    -ms-flex: 0 0 33.333%;
    flex: 0 0 33.333%;
  }
  :deep(.flex-item):nth-child(3n) {
    border-right: none;
  }
  :deep(.flex-item):nth-last-child(1),
  :deep(.flex-item):nth-last-child(2),
  :deep(.flex-item):nth-last-child(3) {
    border-bottom: none;
  }
}

//排序
.container {
  background-color: #ededed;

  list-style: none;
  padding-left: 9px;
  .item {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    float: left;

    .link {
      color: #999;
      -webkit-transition: color 0.3s ease;
      transition: color 0.3s ease;
      line-height: 60px;
      float: left;
      font-size: 12px;
    }
    .active {
      cursor: auto;
      color: #5683ea;
    }
    .dot {
      float: left;
      width: 2px;
      height: 2px;
      margin: 29px 20px;
      background-color: #c7c7c7;
    }
  }
}
.clearfix:after {
  visibility: hidden;
  display: block;
  font-size: 0;
  content: " ";
  clear: both;
  height: 0;
}

ul li::before {
  content: "";
}
</style>
